#ifndef UTILS_H
#define UTILS_H

#define BUFFER_SIZE 10240
#define DATEBASE_NAME "database.db"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
#include <glib.h>
#include <json-c/json.h>
#include <webhttpd/HttpResponse.h>


const char *get_mime_type(const char *filepath);
GList* query_to_dict_list(sqlite3 *db, const char *sql_query);
GList *stmt_to_dict_list(sqlite3_stmt *stmt);
void print_dict_list(GList *list);
void free_dict_list(GList *list);
struct json_object* g_hash_table_to_json_object(GHashTable *hash_table);
struct json_object* g_list_to_json_array(GList *list);
char *url_decode(const char *str);
GHashTable *parse_query_string(const char *query);
void print_g_hash_table(GHashTable *dict);
GHashTable *parse_querys(char *path);
json_object *normal_api_json(int code, char *msg);
json_object *data_api_json(int code, char *msg, int count, json_object *data_array);
HttpResponse normal_response(int status_code, int code, char *msg);

#endif //UTILS_H
